﻿using MediatR;
using T.Settlement.API.Application.Command.ExpensesCommand;
using T.Settlement.Repository.SettlementInterface;

namespace T.Settlement.API.Application.CommandHandlers.ExpensesHandler
{
    public class ExpensesDelCommandHandler : IRequestHandler<ExpensesDelCommand, int>
    {
        /// <summary>
        /// 应付/收费仓储接口
        /// </summary>
        private readonly IExpensesSRepository _expensesSRepository;
        /// <summary>
        /// 构造函数注入
        /// </summary>
        /// <param name="expensesSRepository">应付/收费仓储接口</param>
        public ExpensesDelCommandHandler(IExpensesSRepository expensesSRepository)
        {
            _expensesSRepository = expensesSRepository;
        }
        public async Task<int> Handle(ExpensesDelCommand request, CancellationToken cancellationToken)
        {
            request.IsDeleted = true;
            return await _expensesSRepository.Update(request);
        }
    }
}
